﻿using System;
using System.Collections;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.IO;
using PsychSurvey.Classes;

namespace PsychSurvey
{
    /// <summary>
    /// Summary description for $codebehindclassname$
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class FileUpload : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string filename = context.Request.QueryString["filename"].ToString();            
            string studyId = context.Request.QueryString["studyId"].ToString();
            string FolderName = studyId.Replace("-", "_");
            StudyFileHandler Uploader = new StudyFileHandler(context, studyId);
            Uploader.UploadFileToStudyFolder(filename, context.Request.InputStream);
        }


        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
